package com.zt.bigdata.vertx.interceptor

import com.ecfront.dew.common.Resp
import io.vertx.ext.web.RoutingContext

import scala.concurrent.{Future, Promise}

/**
  *
  */
@FunctionalInterface
trait ProcessFunction[E <: Animal, R <: Object] {
  def process(obj: RoutingContext, e: E, future: Promise[Resp[R]]): Unit

  def process(e: E, obj: RoutingContext): Future[Resp[R]] = {
    val p = Promise[Resp[R]]()
    process(obj, e, p)
    p.future
  }
}
